package com.gsnd.gsnd21study.service.impl;

import com.gsnd.gsnd21study.entity.DRO.UserAndRole;
import com.gsnd.gsnd21study.entity.SysUser;
import com.gsnd.gsnd21study.mapper.SysUserMapper;
import com.gsnd.gsnd21study.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    SysUserMapper sysUserMapper;

    @Override
    public UserAndRole getUserAndRoleByUserId(Long userId) {
        return sysUserMapper.selectUserAndRoleByUserId(userId);
    }

    @Override
    public List<SysUser> getUsersByPage(Integer pageNum, Integer pageSize) {
        int index = (pageNum-1)*pageSize;
        return sysUserMapper.selectByPage(index, pageSize);
    }
}
